{
  "cells": [
    {
      "cell_type": "markdown",
      "id": "d2cd727d",
      "metadata": {
        "id": "d2cd727d"
      },
      "source": [
        "# Fuel Emission Estimator & Forecasting Agent\n",
        "\n",
        "An intelligent agent that calculates annual CO₂ emissions based on user driving patterns and vehicle type. It also forecasts how emissions would change if the user switches to a more fuel-efficient or hybrid vehicle in the future. Powered by OpenAI and designed to assist individuals in making eco-conscious transportation decisions.\n"
      ]
    },
    {
      "cell_type": "markdown",
      "id": "06ae55aa",
      "metadata": {
        "id": "06ae55aa"
      },
      "source": [
        "[![Open in Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/DhivyaBharathy-web/PraisonAI/blob/main/examples/cookbooks/Fuel_Emission_Agent_Intelligence_Agent.ipynb)"
      ]
    },
    {
      "cell_type": "markdown",
      "id": "227e582f",
      "metadata": {
        "id": "227e582f"
      },
      "source": [
        "# Dependencies"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": null,
      "id": "c59db014",
      "metadata": {
        "id": "c59db014"
      },
      "outputs": [],
      "source": [
        "!pip install -q praisonaiagents openai duckduckgo_search \"anyio<4\""
      ]
    },
    {
      "cell_type": "markdown",
      "id": "0L9HTI3GcU63",
      "metadata": {
        "id": "0L9HTI3GcU63"
      },
      "source": [
        "# Set API Key"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": null,
      "id": "SpBU5DL5brYh",
      "metadata": {
        "colab": {
          "base_uri": "https://localhost:8080/"
        },
        "id": "SpBU5DL5brYh",
        "outputId": "e56c185c-5f0c-4939-e4dc-0418667a04a8"
      },
      "outputs": [
        {
          "name": "stdout",
          "output_type": "stream",
          "text": [
            "🔐 Enter your OpenAI API Key: ··········\n"
          ]
        }
      ],
      "source": [
        "import os\n",
        "from getpass import getpass\n",
        "\n",
        "os.environ[\"OPENAI_API_KEY\"] = getpass(\"🔐 Enter your OpenAI API Key: \")\n"
      ]
    },
    {
      "cell_type": "markdown",
      "id": "VBZ30nKucXvA",
      "metadata": {
        "id": "VBZ30nKucXvA"
      },
      "source": [
        "# Create a Fuel Emission Agent"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": null,
      "id": "-C8fVp-1bwOu",
      "metadata": {
        "id": "-C8fVp-1bwOu"
      },
      "outputs": [],
      "source": [
        "from praisonaiagents import Agent\n",
        "\n",
        "yaml_prompt = \"\"\"\n",
        "name: FuelEmissionMiniAgent\n",
        "role: Calculate CO2 emissions based on user driving habits and forecast impact of switching to hybrid vehicles.\n",
        "goal: Return estimated annual CO2 output and forecast change in emissions with different vehicle types.\n",
        "tools:\n",
        "  - openai\n",
        "responses:\n",
        "  - concise\n",
        "  - clear\n",
        "\"\"\"\n",
        "\n",
        "agent = Agent(\n",
        "    name=\"FuelEmissionMiniAgent\",\n",
        "    instructions=yaml_prompt\n",
        ")\n"
      ]
    },
    {
      "cell_type": "markdown",
      "id": "SQ7Pcki7ca1S",
      "metadata": {
        "id": "SQ7Pcki7ca1S"
      },
      "source": [
        "# Run the Agent with Your Question"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": null,
      "id": "njNLFurYby3L",
      "metadata": {
        "colab": {
          "base_uri": "https://localhost:8080/",
          "height": 1000,
          "referenced_widgets": [
            "1b8ec3bc72c54cc4ae7649115185eda4",
            "40ef4acb2e2341a883f0a6b12eee4d19"
          ]
        },
        "id": "njNLFurYby3L",
        "outputId": "3e3f886a-8af6-4357-d98c-f0c00006c755"
      },
      "outputs": [
        {
          "data": {
            "text/html": [
              "<pre style=\"white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace\"><span style=\"color: #d2e3c8; text-decoration-color: #d2e3c8\">╭─ </span><span style=\"color: #d2e3c8; text-decoration-color: #d2e3c8; font-weight: bold\">Agent Info</span><span style=\"color: #d2e3c8; text-decoration-color: #d2e3c8\"> ────────────────────────────────────────────────────────────────────────────────────────────────────╮</span>\n",
              "<span style=\"color: #d2e3c8; text-decoration-color: #d2e3c8\">│</span>                                                                                                                 <span style=\"color: #d2e3c8; text-decoration-color: #d2e3c8\">│</span>\n",
              "<span style=\"color: #d2e3c8; text-decoration-color: #d2e3c8\">│</span>  <span style=\"color: #ff9b9b; text-decoration-color: #ff9b9b; font-weight: bold\">👤 Agent:</span> <span style=\"color: #ffe5e5; text-decoration-color: #ffe5e5\">FuelEmissionMiniAgent</span>                                                                                <span style=\"color: #d2e3c8; text-decoration-color: #d2e3c8\">│</span>\n",
              "<span style=\"color: #d2e3c8; text-decoration-color: #d2e3c8\">│</span>  <span style=\"color: #b4b4b3; text-decoration-color: #b4b4b3; font-weight: bold\">Role:</span> <span style=\"color: #ffe5e5; text-decoration-color: #ffe5e5\">Assistant</span>                                                                                                <span style=\"color: #d2e3c8; text-decoration-color: #d2e3c8\">│</span>\n",
              "<span style=\"color: #d2e3c8; text-decoration-color: #d2e3c8\">│</span>                                                                                                                 <span style=\"color: #d2e3c8; text-decoration-color: #d2e3c8\">│</span>\n",
              "<span style=\"color: #d2e3c8; text-decoration-color: #d2e3c8\">╰─────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯</span>\n",
              "</pre>\n"
            ],
            "text/plain": [
              "\u001b[38;2;210;227;200m╭─\u001b[0m\u001b[38;2;210;227;200m \u001b[0m\u001b[1;38;2;210;227;200mAgent Info\u001b[0m\u001b[38;2;210;227;200m \u001b[0m\u001b[38;2;210;227;200m───────────────────────────────────────────────────────────────────────────────────────────────────\u001b[0m\u001b[38;2;210;227;200m─╮\u001b[0m\n",
              "\u001b[38;2;210;227;200m│\u001b[0m                                                                                                                 \u001b[38;2;210;227;200m│\u001b[0m\n",
              "\u001b[38;2;210;227;200m│\u001b[0m  \u001b[1;38;2;255;155;155m👤 Agent:\u001b[0m \u001b[38;2;255;229;229mFuelEmissionMiniAgent\u001b[0m                                                                                \u001b[38;2;210;227;200m│\u001b[0m\n",
              "\u001b[38;2;210;227;200m│\u001b[0m  \u001b[1;38;2;180;180;179mRole:\u001b[0m \u001b[38;2;255;229;229mAssistant\u001b[0m                                                                                                \u001b[38;2;210;227;200m│\u001b[0m\n",
              "\u001b[38;2;210;227;200m│\u001b[0m                                                                                                                 \u001b[38;2;210;227;200m│\u001b[0m\n",
              "\u001b[38;2;210;227;200m╰─────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯\u001b[0m\n"
            ]
          },
          "metadata": {},
          "output_type": "display_data"
        },
        {
          "data": {
            "application/vnd.jupyter.widget-view+json": {
              "model_id": "1b8ec3bc72c54cc4ae7649115185eda4",
              "version_major": 2,
              "version_minor": 0
            },
            "text/plain": [
              "Output()"
            ]
          },
          "metadata": {},
          "output_type": "display_data"
        },
        {
          "data": {
            "text/html": [
              "<pre style=\"white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace\"></pre>\n"
            ],
            "text/plain": []
          },
          "metadata": {},
          "output_type": "display_data"
        },
        {
          "data": {
            "text/html": [
              "<pre style=\"white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace\">\n",
              "</pre>\n"
            ],
            "text/plain": [
              "\n"
            ]
          },
          "metadata": {},
          "output_type": "display_data"
        },
        {
          "data": {
            "text/html": [
              "<pre style=\"white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace\"><span style=\"color: #7f7f7f; text-decoration-color: #7f7f7f\">Response generated in 4.0s</span>\n",
              "</pre>\n"
            ],
            "text/plain": [
              "\u001b[2mResponse generated in 4.0s\u001b[0m\n"
            ]
          },
          "metadata": {},
          "output_type": "display_data"
        },
        {
          "data": {
            "text/html": [
              "<pre style=\"white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace\"><span style=\"color: #008080; text-decoration-color: #008080\">╭───────────────────────────────────────────────────── Task ──────────────────────────────────────────────────────╮</span>\n",
              "<span style=\"color: #008080; text-decoration-color: #008080\">│</span> I drive 12,000 km per year using a petrol car that gets 10 km/l. How much CO2 do I emit annually? How would     <span style=\"color: #008080; text-decoration-color: #008080\">│</span>\n",
              "<span style=\"color: #008080; text-decoration-color: #008080\">│</span> this change if I switch to a hybrid vehicle in 2 years?                                                         <span style=\"color: #008080; text-decoration-color: #008080\">│</span>\n",
              "<span style=\"color: #008080; text-decoration-color: #008080\">╰─────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯</span>\n",
              "</pre>\n"
            ],
            "text/plain": [
              "\u001b[36m╭─\u001b[0m\u001b[36m────────────────────────────────────────────────────\u001b[0m\u001b[36m Task \u001b[0m\u001b[36m─────────────────────────────────────────────────────\u001b[0m\u001b[36m─╮\u001b[0m\n",
              "\u001b[36m│\u001b[0m I drive 12,000 km per year using a petrol car that gets 10 km/l. How much CO2 do I emit annually? How would     \u001b[36m│\u001b[0m\n",
              "\u001b[36m│\u001b[0m this change if I switch to a hybrid vehicle in 2 years?                                                         \u001b[36m│\u001b[0m\n",
              "\u001b[36m╰─────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯\u001b[0m\n"
            ]
          },
          "metadata": {},
          "output_type": "display_data"
        },
        {
          "data": {
            "text/html": [
              "<pre style=\"white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace\"><span style=\"color: #008080; text-decoration-color: #008080\">╭─────────────────────────────────────────────────── Response ────────────────────────────────────────────────────╮</span>\n",
              "<span style=\"color: #008080; text-decoration-color: #008080\">│</span> To calculate your annual CO2 emissions, we first need to determine the amount of fuel you use annually:         <span style=\"color: #008080; text-decoration-color: #008080\">│</span>\n",
              "<span style=\"color: #008080; text-decoration-color: #008080\">│</span>                                                                                                                 <span style=\"color: #008080; text-decoration-color: #008080\">│</span>\n",
              "<span style=\"color: #008080; text-decoration-color: #008080\">│</span> <span style=\"color: #808000; text-decoration-color: #808000; font-weight: bold\"> 1 </span><span style=\"font-weight: bold\">Fuel Consumption</span>:                                                                                            <span style=\"color: #008080; text-decoration-color: #008080\">│</span>\n",
              "<span style=\"color: #008080; text-decoration-color: #008080\">│</span> <span style=\"color: #808000; text-decoration-color: #808000; font-weight: bold\">    • </span>Distance driven per year: 12,000 km                                                                       <span style=\"color: #008080; text-decoration-color: #008080\">│</span>\n",
              "<span style=\"color: #008080; text-decoration-color: #008080\">│</span> <span style=\"color: #808000; text-decoration-color: #808000; font-weight: bold\">    • </span>Fuel efficiency: 10 km/l                                                                                  <span style=\"color: #008080; text-decoration-color: #008080\">│</span>\n",
              "<span style=\"color: #008080; text-decoration-color: #008080\">│</span> <span style=\"color: #808000; text-decoration-color: #808000; font-weight: bold\">    • </span>Annual fuel consumption = 12,000 km / 10 km/l = 1,200 liters                                              <span style=\"color: #008080; text-decoration-color: #008080\">│</span>\n",
              "<span style=\"color: #008080; text-decoration-color: #008080\">│</span> <span style=\"color: #808000; text-decoration-color: #808000; font-weight: bold\"> 2 </span><span style=\"font-weight: bold\">CO2 Emissions</span>:                                                                                               <span style=\"color: #008080; text-decoration-color: #008080\">│</span>\n",
              "<span style=\"color: #008080; text-decoration-color: #008080\">│</span> <span style=\"color: #808000; text-decoration-color: #808000; font-weight: bold\">    • </span>Petrol emits approximately 2.31 kg of CO2 per liter.                                                      <span style=\"color: #008080; text-decoration-color: #008080\">│</span>\n",
              "<span style=\"color: #008080; text-decoration-color: #008080\">│</span> <span style=\"color: #808000; text-decoration-color: #808000; font-weight: bold\">    • </span>Annual CO2 emissions = 1,200 liters * 2.31 kg/l = 2,772 kg of CO2                                         <span style=\"color: #008080; text-decoration-color: #008080\">│</span>\n",
              "<span style=\"color: #008080; text-decoration-color: #008080\">│</span>                                                                                                                 <span style=\"color: #008080; text-decoration-color: #008080\">│</span>\n",
              "<span style=\"color: #008080; text-decoration-color: #008080\">│</span> If you switch to a hybrid vehicle in 2 years, let's assume the hybrid has a fuel efficiency of 20 km/l (a       <span style=\"color: #008080; text-decoration-color: #008080\">│</span>\n",
              "<span style=\"color: #008080; text-decoration-color: #008080\">│</span> common improvement over traditional petrol cars):                                                               <span style=\"color: #008080; text-decoration-color: #008080\">│</span>\n",
              "<span style=\"color: #008080; text-decoration-color: #008080\">│</span>                                                                                                                 <span style=\"color: #008080; text-decoration-color: #008080\">│</span>\n",
              "<span style=\"color: #008080; text-decoration-color: #008080\">│</span> <span style=\"color: #808000; text-decoration-color: #808000; font-weight: bold\"> 1 </span><span style=\"font-weight: bold\">Hybrid Fuel Consumption</span>:                                                                                     <span style=\"color: #008080; text-decoration-color: #008080\">│</span>\n",
              "<span style=\"color: #008080; text-decoration-color: #008080\">│</span> <span style=\"color: #808000; text-decoration-color: #808000; font-weight: bold\">    • </span>Distance driven per year: 12,000 km                                                                       <span style=\"color: #008080; text-decoration-color: #008080\">│</span>\n",
              "<span style=\"color: #008080; text-decoration-color: #008080\">│</span> <span style=\"color: #808000; text-decoration-color: #808000; font-weight: bold\">    • </span>Hybrid fuel efficiency: 20 km/l                                                                           <span style=\"color: #008080; text-decoration-color: #008080\">│</span>\n",
              "<span style=\"color: #008080; text-decoration-color: #008080\">│</span> <span style=\"color: #808000; text-decoration-color: #808000; font-weight: bold\">    • </span>Annual fuel consumption = 12,000 km / 20 km/l = 600 liters                                                <span style=\"color: #008080; text-decoration-color: #008080\">│</span>\n",
              "<span style=\"color: #008080; text-decoration-color: #008080\">│</span> <span style=\"color: #808000; text-decoration-color: #808000; font-weight: bold\"> 2 </span><span style=\"font-weight: bold\">Hybrid CO2 Emissions</span>:                                                                                        <span style=\"color: #008080; text-decoration-color: #008080\">│</span>\n",
              "<span style=\"color: #008080; text-decoration-color: #008080\">│</span> <span style=\"color: #808000; text-decoration-color: #808000; font-weight: bold\">    • </span>Annual CO2 emissions = 600 liters * 2.31 kg/l = 1,386 kg of CO2                                           <span style=\"color: #008080; text-decoration-color: #008080\">│</span>\n",
              "<span style=\"color: #008080; text-decoration-color: #008080\">│</span>                                                                                                                 <span style=\"color: #008080; text-decoration-color: #008080\">│</span>\n",
              "<span style=\"color: #008080; text-decoration-color: #008080\">│</span> <span style=\"font-weight: bold\">Forecasted Change</span>:                                                                                              <span style=\"color: #008080; text-decoration-color: #008080\">│</span>\n",
              "<span style=\"color: #008080; text-decoration-color: #008080\">│</span>                                                                                                                 <span style=\"color: #008080; text-decoration-color: #008080\">│</span>\n",
              "<span style=\"color: #008080; text-decoration-color: #008080\">│</span> <span style=\"color: #808000; text-decoration-color: #808000; font-weight: bold\"> • </span>Current annual emissions: 2,772 kg of CO2                                                                    <span style=\"color: #008080; text-decoration-color: #008080\">│</span>\n",
              "<span style=\"color: #008080; text-decoration-color: #008080\">│</span> <span style=\"color: #808000; text-decoration-color: #808000; font-weight: bold\"> • </span>Future annual emissions with hybrid: 1,386 kg of CO2                                                         <span style=\"color: #008080; text-decoration-color: #008080\">│</span>\n",
              "<span style=\"color: #008080; text-decoration-color: #008080\">│</span> <span style=\"color: #808000; text-decoration-color: #808000; font-weight: bold\"> • </span>Reduction in emissions: 2,772 kg - 1,386 kg = 1,386 kg of CO2                                                <span style=\"color: #008080; text-decoration-color: #008080\">│</span>\n",
              "<span style=\"color: #008080; text-decoration-color: #008080\">│</span>                                                                                                                 <span style=\"color: #008080; text-decoration-color: #008080\">│</span>\n",
              "<span style=\"color: #008080; text-decoration-color: #008080\">│</span> Switching to a hybrid vehicle could reduce your annual CO2 emissions by approximately 50%.                      <span style=\"color: #008080; text-decoration-color: #008080\">│</span>\n",
              "<span style=\"color: #008080; text-decoration-color: #008080\">╰─────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯</span>\n",
              "</pre>\n"
            ],
            "text/plain": [
              "\u001b[36m╭─\u001b[0m\u001b[36m──────────────────────────────────────────────────\u001b[0m\u001b[36m Response \u001b[0m\u001b[36m───────────────────────────────────────────────────\u001b[0m\u001b[36m─╮\u001b[0m\n",
              "\u001b[36m│\u001b[0m To calculate your annual CO2 emissions, we first need to determine the amount of fuel you use annually:         \u001b[36m│\u001b[0m\n",
              "\u001b[36m│\u001b[0m                                                                                                                 \u001b[36m│\u001b[0m\n",
              "\u001b[36m│\u001b[0m \u001b[1;33m 1 \u001b[0m\u001b[1mFuel Consumption\u001b[0m:                                                                                            \u001b[36m│\u001b[0m\n",
              "\u001b[36m│\u001b[0m \u001b[1;33m   \u001b[0m\u001b[1;33m • \u001b[0mDistance driven per year: 12,000 km                                                                       \u001b[36m│\u001b[0m\n",
              "\u001b[36m│\u001b[0m \u001b[1;33m   \u001b[0m\u001b[1;33m • \u001b[0mFuel efficiency: 10 km/l                                                                                  \u001b[36m│\u001b[0m\n",
              "\u001b[36m│\u001b[0m \u001b[1;33m   \u001b[0m\u001b[1;33m • \u001b[0mAnnual fuel consumption = 12,000 km / 10 km/l = 1,200 liters                                              \u001b[36m│\u001b[0m\n",
              "\u001b[36m│\u001b[0m \u001b[1;33m 2 \u001b[0m\u001b[1mCO2 Emissions\u001b[0m:                                                                                               \u001b[36m│\u001b[0m\n",
              "\u001b[36m│\u001b[0m \u001b[1;33m   \u001b[0m\u001b[1;33m • \u001b[0mPetrol emits approximately 2.31 kg of CO2 per liter.                                                      \u001b[36m│\u001b[0m\n",
              "\u001b[36m│\u001b[0m \u001b[1;33m   \u001b[0m\u001b[1;33m • \u001b[0mAnnual CO2 emissions = 1,200 liters * 2.31 kg/l = 2,772 kg of CO2                                         \u001b[36m│\u001b[0m\n",
              "\u001b[36m│\u001b[0m                                                                                                                 \u001b[36m│\u001b[0m\n",
              "\u001b[36m│\u001b[0m If you switch to a hybrid vehicle in 2 years, let's assume the hybrid has a fuel efficiency of 20 km/l (a       \u001b[36m│\u001b[0m\n",
              "\u001b[36m│\u001b[0m common improvement over traditional petrol cars):                                                               \u001b[36m│\u001b[0m\n",
              "\u001b[36m│\u001b[0m                                                                                                                 \u001b[36m│\u001b[0m\n",
              "\u001b[36m│\u001b[0m \u001b[1;33m 1 \u001b[0m\u001b[1mHybrid Fuel Consumption\u001b[0m:                                                                                     \u001b[36m│\u001b[0m\n",
              "\u001b[36m│\u001b[0m \u001b[1;33m   \u001b[0m\u001b[1;33m • \u001b[0mDistance driven per year: 12,000 km                                                                       \u001b[36m│\u001b[0m\n",
              "\u001b[36m│\u001b[0m \u001b[1;33m   \u001b[0m\u001b[1;33m • \u001b[0mHybrid fuel efficiency: 20 km/l                                                                           \u001b[36m│\u001b[0m\n",
              "\u001b[36m│\u001b[0m \u001b[1;33m   \u001b[0m\u001b[1;33m • \u001b[0mAnnual fuel consumption = 12,000 km / 20 km/l = 600 liters                                                \u001b[36m│\u001b[0m\n",
              "\u001b[36m│\u001b[0m \u001b[1;33m 2 \u001b[0m\u001b[1mHybrid CO2 Emissions\u001b[0m:                                                                                        \u001b[36m│\u001b[0m\n",
              "\u001b[36m│\u001b[0m \u001b[1;33m   \u001b[0m\u001b[1;33m • \u001b[0mAnnual CO2 emissions = 600 liters * 2.31 kg/l = 1,386 kg of CO2                                           \u001b[36m│\u001b[0m\n",
              "\u001b[36m│\u001b[0m                                                                                                                 \u001b[36m│\u001b[0m\n",
              "\u001b[36m│\u001b[0m \u001b[1mForecasted Change\u001b[0m:                                                                                              \u001b[36m│\u001b[0m\n",
              "\u001b[36m│\u001b[0m                                                                                                                 \u001b[36m│\u001b[0m\n",
              "\u001b[36m│\u001b[0m \u001b[1;33m • \u001b[0mCurrent annual emissions: 2,772 kg of CO2                                                                    \u001b[36m│\u001b[0m\n",
              "\u001b[36m│\u001b[0m \u001b[1;33m • \u001b[0mFuture annual emissions with hybrid: 1,386 kg of CO2                                                         \u001b[36m│\u001b[0m\n",
              "\u001b[36m│\u001b[0m \u001b[1;33m • \u001b[0mReduction in emissions: 2,772 kg - 1,386 kg = 1,386 kg of CO2                                                \u001b[36m│\u001b[0m\n",
              "\u001b[36m│\u001b[0m                                                                                                                 \u001b[36m│\u001b[0m\n",
              "\u001b[36m│\u001b[0m Switching to a hybrid vehicle could reduce your annual CO2 emissions by approximately 50%.                      \u001b[36m│\u001b[0m\n",
              "\u001b[36m╰─────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯\u001b[0m\n"
            ]
          },
          "metadata": {},
          "output_type": "display_data"
        },
        {
          "name": "stdout",
          "output_type": "stream",
          "text": [
            "To calculate your annual CO2 emissions, we first need to determine the amount of fuel you use annually:\n",
            "\n",
            "1. **Fuel Consumption**:  \n",
            "   - Distance driven per year: 12,000 km  \n",
            "   - Fuel efficiency: 10 km/l  \n",
            "   - Annual fuel consumption = 12,000 km / 10 km/l = 1,200 liters\n",
            "\n",
            "2. **CO2 Emissions**:  \n",
            "   - Petrol emits approximately 2.31 kg of CO2 per liter.  \n",
            "   - Annual CO2 emissions = 1,200 liters * 2.31 kg/l = 2,772 kg of CO2\n",
            "\n",
            "If you switch to a hybrid vehicle in 2 years, let's assume the hybrid has a fuel efficiency of 20 km/l (a common improvement over traditional petrol cars):\n",
            "\n",
            "1. **Hybrid Fuel Consumption**:  \n",
            "   - Distance driven per year: 12,000 km  \n",
            "   - Hybrid fuel efficiency: 20 km/l  \n",
            "   - Annual fuel consumption = 12,000 km / 20 km/l = 600 liters\n",
            "\n",
            "2. **Hybrid CO2 Emissions**:  \n",
            "   - Annual CO2 emissions = 600 liters * 2.31 kg/l = 1,386 kg of CO2\n",
            "\n",
            "**Forecasted Change**:  \n",
            "- Current annual emissions: 2,772 kg of CO2  \n",
            "- Future annual emissions with hybrid: 1,386 kg of CO2  \n",
            "- Reduction in emissions: 2,772 kg - 1,386 kg = 1,386 kg of CO2\n",
            "\n",
            "Switching to a hybrid vehicle could reduce your annual CO2 emissions by approximately 50%.\n"
          ]
        }
      ],
      "source": [
        "query = (\n",
        "    \"I drive 12,000 km per year using a petrol car that gets 10 km/l. \"\n",
        "    \"How much CO2 do I emit annually? How would this change if I switch to a hybrid vehicle in 2 years?\"\n",
        ")\n",
        "\n",
        "response = agent.start(prompt=query)\n",
        "print(response)\n"
      ]
    }
  ],
  "metadata": {
    "colab": {
      "provenance": []
    },
    "kernelspec": {
      "display_name": "Python 3",
      "name": "python3"
    },
    "language_info": {
      "name": "python"
    }
  },
  "nbformat": 4,
  "nbformat_minor": 5
}